package com.zj.study.utils.validation.validator.time;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import java.time.LocalDate;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2020.11.0
 */
@ValidateSupport(LocalDate.class)
public class PastOrPresentValidatorForLocalDate extends AbstractPastOrPresentValidator<LocalDate> {

  @Override
  public boolean compare(@NonNull LocalDate value) {
    var now = LocalDate.now();
    return now.isBefore(value) || now.isEqual(value);
  }

}
